//
//  SLHomeBridgeCell.m
//  SlockApp
//
//  Created by 凯朱 on 2025/2/6.
//

#import "SLHomeBridgeCell.h"

@implementation SLHomeBridgeCell

- (void)awakeFromNib {
    [super awakeFromNib];
    _titleLbl.font = [UIFont boldSystemFontOfSize:22];
    _statusLbl.font = kFont(12);
   _bgView.layer.cornerRadius = 20;
   _bgView.layer.masksToBounds = YES;
   _bgView.layer.borderColor = kHexColor(@"#292929").CGColor;
   _bgView.layer.borderWidth = 1;
}

-(void)setModel:(SLLockModel *)model{
    _model = model;
    _titleLbl.text = model.deviceName;
    _bgImageView.image = [model.onlineStatus boolValue] ? [UIImage imageNamed:@"icon_bridge_bg_online"] : [UIImage imageNamed:@"icon_bridge_bg_offline"];
    _statusLbl.text = [model.onlineStatus boolValue] ? kLocalString(@"online.") : kLocalString(@"offline.");
}

- (IBAction)btnAction:(id)sender {
    if (sender == _btn1 || sender == _btn3) {
        if (self.btnBlock) self.btnBlock(1, self.model);
    }else{
        if (self.btnBlock) self.btnBlock(2, self.model);
    }
}

@end
